home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / COMMUNIC / 0576.ZIP / MX.C < prev    next >
Text File  |  1987-04-24  |  3KB  |  147 lines

  1. #include <stdio.h>
  2.  
  3.  
  4. main(argc,argv)
  5.   int argc;
  6.   char *argv[];
  7. {
  8.   int num;
  9.   num=1;
  10.   if (argc<=num)
  11.   choose();
  12.     else
  13.       printf("\n\n");
  14.      if (argv[1][0] == 'C'|| argv[1][0] == 'c')
  15.          condense();
  16.  
  17.    if (argv[1][0] == 'E'|| argv[1][0] == 'e')
  18.          emphasise();
  19.  
  20.    if (argv[1][0] == 'D'|| argv[1][0] == 'd')
  21.           dble();
  22.  
  23.    if (argv[1][0] == 'R'|| argv[1][0] == 'r')
  24.            resprt();
  25.    if (argv[1][0] == '?')
  26.         hlpmsg();
  27.     printf("");
  28.  
  29. }
  30. choose()
  31. {
  32.         int choice;
  33.         clscr();
  34.         setscr();
  35.         choice = getch();
  36.          switch (choice)
  37.            {
  38.                 case 'C' :condense();
  39.                              break;
  40.                 case 'E' :emphasise();
  41.                              break;
  42.                 case 'D' :dble();
  43.                              break;
  44.                 case 'c' :cancond();
  45.                              break;
  46.                 case 'e' :canemph();
  47.                              break;
  48.                 case 'd' :candble();
  49.                              break;
  50.                 case 'R' :resprt();
  51.                              break;
  52.                 default : printf("programme end");
  53.   }
  54. }
  55. setscr()
  56.  
  57. {
  58. int n;
  59.               for (n=1;n<=8;n++)
  60.               {
  61.                putchar('\n');
  62.               }
  63.  
  64.      printf("\n              MX80 printer control programme.");
  65.      printf("\n                  by Ian French 24/04/87");
  66.      printf("\n\n                     Choices available are :\n");
  67.      printf("\n\n     Condensed:   press [ C ]    |   Cancel Condensed:   press [ c ]");
  68.      printf("\n\n     Emphasise:   press [ E ]    |   Cancel Emphasise:   press [ e ]");
  69.      printf("\n\n     Double:      press [ D ]    |   Cancel Double:      press [ d ]");
  70.      printf("\n\n                    RESET ALL OPTIONS PRESS [ R ] ");
  71.      printf("\n\n                    QUIT PROGRAMME PRESS    [ q  ]\n\n\n");
  72.  
  73.  }
  74.  
  75. condense()
  76. {
  77.   putc(0x0f,stdprn);
  78.    putc('\r',stdprn);
  79.     printf("\nCondensed print set");
  80. }
  81.  
  82. cancond()
  83. {
  84.          putc(0x12,stdprn);
  85.           putc('\r',stdprn);
  86.            printf("\ncondensed print cancelled");
  87. }
  88.  
  89. emphasise()
  90. {
  91.    putc(0x1b,stdprn);
  92.     putc(0x45,stdprn);
  93.      putc('\r',stdprn);
  94.       printf("\nEmphasised print set");
  95. }
  96.  
  97. canemph()
  98. {
  99.    putc(0x1b,stdprn);
  100.     putc(0x46,stdprn);
  101.      putc('\r',stdprn);
  102.       printf("\nemphasised print cancelled");
  103. }
  104.  
  105. dble()
  106. {
  107.    putc(0x1b,stdprn);
  108.     putc(0x47,stdprn);
  109.      putc('\r',stdprn);
  110.       printf("\nDouble strike set ");
  111.  
  112. }
  113.  
  114. candble()
  115. {
  116.   putc(0x1b,stdprn);
  117.    putc(0x48,stdprn);
  118.     putc('\r',stdprn);
  119.      printf("\ndouble strike cancelled");
  120.  
  121. }
  122.  
  123. clscr()
  124. {
  125.    int l;
  126.        for (l=1;l<=25;l++)
  127.        {
  128.           putchar('\n');
  129.        }
  130.  }
  131.  resprt()
  132.  {
  133.  candble();
  134.  canemph();
  135.  cancond();
  136.  
  137. }
  138. hlpmsg()
  139. {
  140.      printf("\nMX80 printer control programme.");
  141.      printf("\nby Ian French 24/04/87");
  142.      printf("\n\n\n\nEnter   MX C or c for Condensed print\n");
  143.      printf("\nEnter   MX E or e for Emphasised Print\n");
  144.      printf("\nEnter   MX D or d for Double printing\n");
  145.      printf("\nEnter   MX R  or r for Reset above options\n");
  146.      printf("\n\n Enter MX for full menu\n\n\n");
  147. }